<?php

namespace module\manage\validate;

use app\Validate;

class City extends Validate
{
    /**
     * 所有验证场景需要的字段.
     *
     * @var array<array>
     */
    protected $scene = [
        'save' => ['id', 'pid', 'title']
    ];
    /**
     * Get the validation rules that apply to the request.
     *
     * @var array<string>
     */
    protected $rule = [
        'id' => 'require|integer|max:10',  // ID
        'code'  => 'requireWithout:id|integer',  // 城市编码
        'pid'  => 'requireWithout:id|integer',  // 城市父级
        'title' => 'requireWithout:id|max:60',  // 岗位名称
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'id' => 'ID',
        'code' => '编码',
        'pid' => '父级',
        'title' => '名称',
    ];
}
